package net.gvne.data;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase.CursorFactory;

public class ConnectionInfo extends ConnectionInfoOpenHandler {

	private String streamId;
	private String msUrl;
	private String msUsr;
	private String msPw;

	public ConnectionInfo(Context context) {
		super(context, null, null, 1);
	}

	public void fillConnectionInfo() {
		boolean conInfExists = false;
		read(this);
		if (getMsUrl() != null && getMsUrl().trim().length() > 0) {
			conInfExists = true;
		}
		ConnectionInfoClient client = new ConnectionInfoClient();
		client.readConnectionInfoRemote(this);
		if (conInfExists) {
			update(getStreamId(), getMsUrl(), getMsUsr(), getMsPw());
		} else {
			insert(getStreamId(), getMsUrl(), getMsUsr(), getMsPw());
		}
	}

	public String getStreamId() {
		return streamId;
	}

	public void setStreamId(String streamId) {
		this.streamId = streamId;
	}

	public String getMsUrl() {
		return msUrl;
	}

	public void setMsUrl(String msUrl) {
		this.msUrl = msUrl;
	}

	public String getMsUsr() {
		return msUsr;
	}

	public void setMsUsr(String msUsr) {
		this.msUsr = msUsr;
	}

	public String getMsPw() {
		return msPw;
	}

	public void setMsPw(String msPw) {
		this.msPw = msPw;
	}

	public ConnectionInfo(Context context, String name, CursorFactory factory,
			int version) {
		super(context, name, factory, version);
		// TODO Auto-generated constructor stub
	}

}
